package com.imooc.dianping.common;

/**
 * 通用返回
 * @author LiJian
 * @date 2021/5/16
 */
public class CommonRes {
    /**
     * 表明读经请求的返回处理结果，"success"或"fail"
     */
    private String status;
    /**
     * 若status=success时，表明返回对应的json数据
     * 若status=fail时，返回通用的错误码对应格式
     */
    private Object data;

    public static CommonRes create(Object data){
        return create(data,"success");
    }

    public static CommonRes create(Object data, String status){
        CommonRes commonRes = new CommonRes();
        commonRes.setData(data);
        commonRes.setStatus(status);
        return commonRes;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
